#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTcpSocket>
#include <QTimer>
#include <iostream>

#define MAX_MSG_SIZE 256

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    #define  UID   "f0266ac8a48c97c96ad42822d06864e5"  //用户密钥

    QTcpSocket socket;
    void send_command(const char *uid, const char *topics);
    void subscribe();
    void post(const char *topic, const char *msg, const char *uid=UID);
    void parseAndDisplay(const QByteArray &data);
private slots:
    void on_pushButton_window_clicked();

    void on_pushButton_led_clicked();

    void on_pushButton_fan_clicked();

private:
    Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
